module.exports = (app) => {
  const User = require("../models/User")
  const Live = require("../models/Live")

  const router = require("express").Router({
    // 合并父子路由路径参数
    mergeParams: true,
  })
  //资源路径
  app.use(
    "/admin/api/live",
    async (req, res, next) => {
      next()
    },
    router
  )
  //直播间查询
  router.get("/:_id", async (req, res) => {
    if (!req.params._id) return res.json({ status: -1, msg: "暂无此直播间" })
    let data = await Live.findById(req.params._id).populate("user", [
      "headUrl",
      "nick",
    ])
    res.json(jsonRes(0, "", live))
  })
}
